package com.koron.common.core.util.sms;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName SmsController
 * @Date 2019/6/18 16:24
 * @Description TODO 测试短信，测完删除
 **/
@Controller
@RequestMapping("/sms")
public class SmsController {

    @RequestMapping("/send")
    public String send(String phone, String content){
        List<MobileMessageVO> messageList = new ArrayList<>();
        MobileMessageVO message = new MobileMessageVO();
        message.setReceiverPhone(phone);
        message.setMessageContent(content);
        messageList.add(message);
        IMobileMessageSender messageSender = new MobileMessageSenderImpl();
        int count = messageSender.sendMessage(messageList);

        return String.valueOf(count);
    }
    @RequestMapping("/sendMore")
    public String sendMore(String phone, String content, String phone2, String content2){
        List<MobileMessageVO> messageList = new ArrayList<>();
        MobileMessageVO message = new MobileMessageVO();
        message.setReceiverPhone(phone);
        message.setMessageContent(content);
        messageList.add(message);
        MobileMessageVO message2 = new MobileMessageVO();
        message2.setReceiverPhone(phone2);
        message2.setMessageContent(content2);
        messageList.add(message2);
        IMobileMessageSender messageSender = new MobileMessageSenderImpl();
        int count = messageSender.sendMessage(messageList);

        return String.valueOf(count);
    }
}
